#!/user/bin/env python
# -*- coding:utf-8 -*-
#filename:controllers/tfeetsearch.py

'''
根据关键字查询tfeet 并且用json数据返回

Created on 2011-9-6

@author: zc
'''


from checkkey import checkkey
from tfeetsearchjson import tfeetsearchjson
import web

 
class tfeetsearch():
    '''
        http://tinyfeet.us/i/search/asdf?srckey=c59a1c31ef4615de72155cb508e491b18f626c8fpjefqrzs
        http://tinyfeet.us/i/search/asdf?tfid=1&srckey=c59a1c31ef4615de72155cb508e491b18f626c8fpjefqrzs
        
    '''

    def GET( self, type ):
        referer = web.input( tfid = 0 )  #接收url参数
        tfeets = None

        if checkkey( web.config._session, web.ctx.env ):
            tf = tfeetsearchjson.tfeetsearchjson()
            tfid = referer.tfid
            searchcontent = type
            tfeets = tf.tfeetsearchjson( searchcontent, tfid ) 
        else:
            tfeets = '{"msg":"203", "errmsg":"session验证未通过."}'
        
        return tfeets
